<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .A{
            width: 300px;
            height: 300px;
            background-color: springgreen;
        }
        .B{
            width: 200px;
            height: 200px;
            background-color: red;
        }
        .C{
            width: 100px;
            height: 100px;
            background-color: blue;
        }
    </style>
</head>
<body>
    <div class="A">
        <div class="B">
            <div class="C"></div>
        </div>
    </div>
    <script>
        const a = document.querySelector(".A")
        const b = document.querySelector(".B")
        const c = document.querySelector(".C")
        a.addEventListener("mouseenter",function(){
            console.log("爷爷!!");
        })
        b.addEventListener("mouseenter",function(){
            console.log("爸爸!!");
        })
        c.addEventListener("mouseenter",function(){
            console.log("儿子!!");
        })
    </script>
</body>
</html>